﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.International.Converters.PinYinConverter;

namespace 拼音转化练习
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ChineseChar ch = new ChineseChar('淼');
            //string[] str = ch.Pinyins.ToArray();
            //foreach (string i in str)
            //{
            //    MessageBox.Show(i);
            //}
            for (int i = 0; i < ch.PinyinCount; i++)
            {
                MessageBox.Show(ch.Pinyins[i]);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string txt = textBox1.Text;
            foreach (char i in txt)
            {
                if (ChineseChar.IsValidChar(i))
                {
                    ChineseChar ch = new ChineseChar(i);
                    MessageBox.Show(ch.Pinyins[0]);
                }
                else
                {
                    MessageBox.Show(i.ToString());
                }
            }
        }
    }
}
